﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IOEntity;
using IODataAccess;
using System.Collections;
namespace IOBusiness
{
    public class clsBSSlide
    {
        List<clsSlideCruises> cruisesList = null;
        int itemWidth = 0;
        public clsBSSlide(int pItemWidth)
        {
            itemWidth = pItemWidth;
            cruisesList = new List<clsSlideCruises>();
        }

        public void GetData(string pID)
        {
            cruisesList = new clsDASlideCruises().GetCruisesList(pID,itemWidth);
        }

        public StringBuilder GetCode()
        {
            StringBuilder strCode = new StringBuilder();
            strCode.AppendLine("<script type=\"text/javascript\">");
            strCode.AppendLine("var items_list = new Array();");
            for (int i = 0; i < cruisesList.Count; i++)
            {
                strCode.AppendLine("items_list[" + i + "] = { id: \"" + cruisesList[i].ID + "\", position: \"" + cruisesList[i].Position + "\", index: " + cruisesList[i].Index + ", description: \"" + cruisesList[i].Description + "\", photo: \"" + cruisesList[i].Photo + "\" };");
            }
            strCode.AppendLine("</script>");
            strCode.AppendLine("");

            return strCode;
        }

        public StringBuilder GetCruisesItem()
        {
            StringBuilder strCode = new StringBuilder();
            for (int i = 0; i < cruisesList.Count; i++)
            {
                strCode.AppendLine("<li>");
                strCode.AppendLine("<img alt=\"" + cruisesList[i].Description + "\" class=\"item\" id=\"" + cruisesList[i].ID + "\" src=\"" + cruisesList[i].Photo + "\" width=\"95px\" height=\"55px\" />");
                strCode.AppendLine("</li>");
            }

            return strCode;
        }
    }
}
